#{extends 'main.html' /}

<h1>Edit the offer</h1>
<br>
<br>
* Required
#{if user.getClass() == models.CommercialOfferer.class}
#{form @Profile.saveCommercial(userId = user.id), enctype:'multipart/form-data'}
    <fieldset>              
        <legend>User profile</legend>  

        <div class="field">
            <label for="email">email *</label>                  
            <input id="email" type="text" name="email" size="30" value="${user.email}" class="#{errorClass 'startDate' /}" /> 
            <span class="error">#{error 'email' /}</span>
        </div>
        
         #{if user.getClass() == models.CommercialOfferer.class}
        <div class="field">
            <label for="hotelname">hotel name *</label>                  
            <input id="hotelname" type="text" name="hotelname" size="30" value="${user.hotelname}" class="#{errorClass 'hotelname' /}" /> 
            <span class="error">#{error 'hotelname' /}</span>
        </div>
        
        <div class="field">
            <label for="hotellink">hotel link</label>                  
            <input id="hotellink" type="text" name="hotellink" size="30" value="${user.hotellink}" class="#{errorClass 'hotellink' /}" /> 
            <span class="error">#{error 'hotellink' /}</span>
        </div>
        
        <div class="field">
            <label for="stars">stars</label>                  
            <input id="stars" type="text" name="stars" size="30" value="${user.stars}" class="#{errorClass 'stars' /}" /> 
            <span class="error">#{error 'stars' /}</span>
        </div>
        #{/if}
        
        <div class="field">
            <label for="firstname">first name *</label>                  
            <input id="firstname" type="text" name="firstname" size="30" value="${user.firstname}" class="#{errorClass 'firstname' /}" /> 
            <span class="error">#{error 'firstname' /}</span>
        </div>
        
         <div class="field">
            <label for="lastname">last name *</label>                  
            <input id="lastname" type="text" name="lastname" size="30" value="${user.lastname}" class="#{errorClass 'lastname' /}" /> 
            <span class="error">#{error 'lastname' /}</span>
        </div>
        
         <div class="field">
            <label for="dateOfBirth">date of birth *</label>                  
            <input id="dateOfBirth" type="date" name="dateOfBirth" size="30" value="${user.dateOfBirth.format('yyyy-MM-dd')}" class="#{errorClass 'dateOfBirth' /}" /> 
            <span class="error">#{error 'dateOfBirth' /}</span>
        </div>
        
        <div class="field">
            <label for="street">Street name *</label>                  
            <input id="street" type="text" name="street" size="30" value="${user.street}" class="#{errorClass 'street' /}" /> 
            <span class="error">#{error 'street' /}</span>
        </div>
        
        <div class="field">
            <label for="streetNumber">Street number *</label>                  
            <input id="streetNumber" type="text" name="streetNumber" size="30" value="${user.streetNumber}" class="#{errorClass 'streetNumber' /}" /> 
            <span class="error">#{error 'streetNumber' /}</span>
        </div>       
        
        <div class="field">
            <label for="city">City *</label>                  
            <input id="city" type="text" name="city" size="30" value="${user.city}" class="#{errorClass 'city' /}" /> 
            <span class="error">#{error 'city' /}</span>
        </div> 
        
        <div class="field">
            <label for="zipcode">Zip Code *</label>                  
            <input id="zipcode" type="text" name="zipcode" size="10" value="${user.zipcode}" class="#{errorClass 'zipcode' /}" /> 
            <span class="error">#{error 'zipcode' /}</span>
        </div>   
        
        <div class="field">
            <label for="telephone">telephone </label>                  
            <input id="telephone" type="text" name="telephone" telephone="5" value="${user.telephone}" class="#{errorClass 'telephone' /}" />
            <span class="error">#{error 'telephone' /}</span>
        </div>
        
        <div class="field">
            <label for="oldPassword">old password *</label>                  
            <input id="oldPassword" type="password" name="oldPassword" size="30" class="#{errorClass 'oldPassword' /}" />
            <span class="error">#{error 'oldPassword' /}</span>
        </div>     
        
        <div class="field">
            <label for="newPassword">new password </label>                  
            <input id="newPassword" type="password" name="newPassword"  size="30" class="#{errorClass 'newPassword' /}" /> Only fill in if you want to change your password!
            <span class="error">#{error 'newPassword' /}</span>
        </div>
        
        <div class="field">
            <label for="confirmNewPassword">confirm new password </label>                  
            <input id="confirmNewPassword" type="password" name="confirmNewPassword" size="30" class="#{errorClass 'confirmNewPassword' /}" /> Only fill in if you want to change your password!
            <span class="error">#{error 'confirmNewPassword' /}</span>
        </div>                
        
    </fieldset>
                    
    <input type="submit" class="submit" value=" edit profile " />
    
#{/form}
#{/if}

#{else}
#{form @Profile.savePrivate(userId = user.id), enctype:'multipart/form-data'}
    <fieldset>              
        <legend>User profile</legend>  

        <div class="field">
            <label for="email">email *</label>                  
            <input id="email" type="text" name="email" size="30" value="${user.email}" class="#{errorClass 'startDate' /}" /> 
            <span class="error">#{error 'email' /}</span>
        </div>
        
        
        <div class="field">
            <label for="firstname">first name *</label>                  
            <input id="firstname" type="text" name="firstname" size="30" value="${user.firstname}" class="#{errorClass 'firstname' /}" /> 
            <span class="error">#{error 'firstname' /}</span>
        </div>
        
         <div class="field">
            <label for="lastname">last name *</label>                  
            <input id="lastname" type="text" name="lastname" size="30" value="${user.lastname}" class="#{errorClass 'lastname' /}" /> 
            <span class="error">#{error 'lastname' /}</span>
        </div>
        
         <div class="field">
            <label for="dateOfBirth">date of birth *</label>                  
            <input id="dateOfBirth" type="date" name="dateOfBirth" size="30" value="${user.dateOfBirth.format('yyyy-MM-dd')}" class="#{errorClass 'dateOfBirth' /}" /> 
            <span class="error">#{error 'dateOfBirth' /}</span>
        </div>
        
        <div class="field">
            <label for="street">Street name *</label>                  
            <input id="street" type="text" name="street" size="30" value="${user.street}" class="#{errorClass 'street' /}" /> 
            <span class="error">#{error 'street' /}</span>
        </div>
        
        <div class="field">
            <label for="streetNumber">Street number *</label>                  
            <input id="streetNumber" type="text" name="streetNumber" size="30" value="${user.streetNumber}" class="#{errorClass 'streetNumber' /}" /> 
            <span class="error">#{error 'streetNumber' /}</span>
        </div>       
        
        <div class="field">
            <label for="city">City *</label>                  
            <input id="city" type="text" name="city" size="30" value="${user.city}" class="#{errorClass 'city' /}" /> 
            <span class="error">#{error 'city' /}</span>
        </div> 
        
        <div class="field">
            <label for="zipcode">Zip Code *</label>                  
            <input id="zipcode" type="text" name="zipcode" size="10" value="${user.zipcode}" class="#{errorClass 'zipcode' /}" /> 
            <span class="error">#{error 'zipcode' /}</span>
        </div>   
        
        <div class="field">
            <label for="telephone">telephone </label>                  
            <input id="telephone" type="text" name="telephone" telephone="5" value="${user.telephone}" class="#{errorClass 'telephone' /}" />
            <span class="error">#{error 'telephone' /}</span>
        </div>
        
        <div class="field">
            <label for="oldPassword">old password *</label>                  
            <input id="oldPassword" type="password" name="oldPassword" size="30" class="#{errorClass 'oldPassword' /}" />
            <span class="error">#{error 'oldPassword' /}</span>
        </div>     
        
        <div class="field">
            <label for="newPassword">new password </label>                  
            <input id="newPassword" type="password" name="newPassword" size="30" class="#{errorClass 'newPassword' /}" /> Only fill in if you want to change your password!
            <span class="error">#{error 'newPassword' /}</span>
        </div>
        
        <div class="field">
            <label for="confirmNewPassword">confirm new password </label>                  
            <input id="confirmNewPassword" type="password" name="confirmNewPassword" size="30" class="#{errorClass 'confirmNewPassword' /}" /> Only fill in if you want to change your password!
            <span class="error">#{error 'confirmNewPassword' /}</span>
        </div>                
        
    </fieldset>
                    
    <input type="submit" class="submit" value=" edit profile " />
    
#{/form}
#{/else}